package action.observer;

public class App {

    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();
        Displayer one = new Displayer("观察者一");
        Displayer two = new Displayer("观察者二");
        one.registerToSubject(weatherData);
        two.registerToSubject(weatherData);

        weatherData.setWeather(12,32);
        one.removeFromSubject(weatherData);
        System.out.println("观察者二取消订阅后:");
        weatherData.setWeather(1,2);
    }
}
